# Maintainer: Felix Yan <felixonmars@archlinux.org>

pkgname=python-pytest-localserver
pkgver=0.7.1
pkgrel=2
pkgdesc='py.test plugin to test server connections locally'
arch=('any')
license=('MIT')
url='https://bitbucket.org/pytest-dev/pytest-localserver'
depends=('python-pytest' 'python-werkzeug')
optdepends=('python-aiosmtpd: for smtp')
makedepends=('python-setuptools')
checkdepends=('python-requests')
source=(https://files.pythonhosted.org/packages/source/p/pytest-localserver/pytest-localserver-$pkgver.tar.gz)
sha512sums=('fd32ea020152a17fb1dcfe3f5cccd5c2a26eed18b711f51c5c7cb8534862706e6738651c275e88f3cbad54ecdb59e4b5588e67eed0ff3bbf20c3636e97990ed6')

build() {
  cd pytest-localserver-$pkgver
  python setup.py build
}

check() {
  # Hack entry points by installing it

  cd pytest-localserver-$pkgver
  python setup.py install --root="$PWD/tmp_install" --optimize=1
  local site_packages=$(python -c "import site; print(site.getsitepackages()[0])")
  PYTHONPATH="$PWD/tmp_install/$site_packages:$PYTHONPATH" pytest
}

package() {
  cd pytest-localserver-$pkgver
  python setup.py install --root="$pkgdir" --optimize=1
  install -Dm644 LICENSE -t "$pkgdir"/usr/share/licenses/$pkgname/
}

# vim:set ts=2 sw=2 et:
